<!--海外验收管理-->
<template>
  <div class="page-container">
    <page_breadcrumb :getKeyMethod="init_table_model" @change="change_table_model" pageOption />
    <ex_super_table_page v-bind="option" ref="SuperTablePage">

    </ex_super_table_page>
    <!-- <detail_overseas_check ref="detail_overseas_check" /> -->

  </div>
</template>
<script>
import superTablePageFunction from '@/mixin/super-table-page-function';

// import detail_overseas_check from './dialog/detail_overseas_check.vue';
import page_table_model_manage from '@/mixin/page_table_model_manage';
import emitOnFunction from '@/mixin/emit-on-function';
let emitKey = 'overseas=>check_manage'
export default {
  title: "title_standard_check_manager",
  mixins: [superTablePageFunction, emitOnFunction(emitKey), page_table_model_manage],
  components: {},

  data() {
    return {

      option: {
        search: {
          model: [

            { label: 'label_inbound_code', key: 'inboundOrderCode' },
            { label: "label_acceptance_code", key: "acceptanceCode", },
            { label: "label_order_code", key: "receivingOrderCode", },
            {
              label: "label_customer", key: "customerId", type: "common_customer_choose"
            },
            { label: "label_sku", key: "skuId", type: 'sku_selec_input', },

            {
              label: "label_operate_time", key: 'startOperationTime', type: 'date-picker', attrs: { type: 'datetime' },
              render: (h, { data, item }) => {
                const value = data[item.key]
                const limitKey = 'endOperationTime'
                const limitValue = data[limitKey]

                return (<ex_super_input value={value} onInput={e => this.$set(data, item.key, e)} type="date-picker" placeholder="label_start_time"
                  attrs={{ type: 'datetime' }}
                  pickerOptions={{
                    disabledDate: date => { return limitValue ? (limitValue < date.getTime()) : false }
                  }}
                />)
              }

            },
            {
              label: "~", key: 'endOperationTime', type: 'date-picker', attrs: { type: 'datetime' },
              render: (h, { data, item }) => {
                const value = data[item.key]
                const limitKey = 'startOperationTime'
                const limitValue = data[limitKey]
                return (<ex_super_input value={value} onInput={e => this.$set(data, item.key, e)} type="date-picker" placeholder="label_end_time"
                  attrs={{ type: 'datetime', 'default-time': '23:59:59' }}
                  pickerOptions={{
                    disabledDate: date => { return limitValue ? (limitValue > date.getTime()) : false }
                  }}
                />)
              }
            },

            {
              label: "label_acceptance_user", key: "acceptanceUserId", type: "select", storeData: true, url: "/ums-api/user/UserInfoRpc/getUserDict.json",
              option: { label: 'userName', value: 'userId' }, filterable: true,
            },

            {
              label: "label_acceptance_date", key: 'startAcceptanceTime', type: 'date-picker', attrs: { type: 'datetime' },
              render: (h, { data, item }) => {
                const limitKey = 'endAcceptanceTime'; const value = data[item.key]; const limitValue = data[limitKey];
                return (<ex_super_input value={value} onInput={e => this.$set(data, item.key, e)} type="date-picker" placeholder="label_start_time"
                  attrs={{ type: 'datetime' }} pickerOptions={{ disabledDate: date => { return limitValue ? (limitValue < date.getTime()) : false } }}
                />)
              }
            },
            {
              label: "~", key: 'endAcceptanceTime', type: 'date-picker', attrs: { type: 'datetime' },
              render: (h, { data, item }) => {
                const limitKey = 'startAcceptanceTime'; const value = data[item.key]; const limitValue = data[limitKey];
                return (<ex_super_input value={value} onInput={e => this.$set(data, item.key, e)} type="date-picker" placeholder="label_end_time"
                  attrs={{ type: 'datetime', 'default-time': '23:59:59' }} pickerOptions={{ disabledDate: date => { return limitValue ? (limitValue > date.getTime()) : false } }}
                />)
              }
            },
          ],

        },
        actionExtra: [
          {
            label: 'label_new_check', attrs: { type: "primary" }, auth: "/page/wms/overseas/inbound/check",

            click: this.gotoCheck
          },
          // { label: 'label_packing_box_inventory', click: this.$noFunction },
          // { label: 'label_export', click: this.$noFunction },

        ],
        table: {
          url: "/wms-api/inbound/WmsInboundOverseasAcceptanceRpc/selectPage.json",

          model: this.init_table_model(),
        }
      },

    };
  },


  methods: {
    option_table_model() {
      return [
        { type: 'selection', },
        { key: 'code', label: 'label_acceptance_code', 'min-width': 120, 'show-overflow-tooltip': true, },
        { key: 'inboundOrderCode', label: 'label_inbound_code', 'min-width': 120, 'show-overflow-tooltip': true, },
        {
          key: 'customerName', label: 'label_customer_info', 'min-width': 120, 'show-overflow-tooltip': true,
          formatter: (r, c, v, i) => this.$formatNameCode(v, r.customerCode)
        },
        { key: 'receivingOrderCode', label: 'label_order_code', 'min-width': 120, 'show-overflow-tooltip': true, },

        { key: 'receivingBoxQty', label: 'label_receiving_box_number', 'width': 100, },
        { key: 'receivingSkuQty', label: 'label_receiving_number', 'width': 100, },

        { key: 'acceptanceBoxQty', label: 'label_acceptance_box_number', 'width': 100, },
        { key: 'acceptanceSkuQty', label: 'label_acceptance_number', 'width': 100, },
        { key: 'isAbnormal', label: 'label_is_abnormal', 'width': 100, formatter: (r, c, v, i) => this.$enumShow(v, "YesOrNoEnum") },
        { key: 'operationTime', label: 'label_operate_time', 'width': 130, formatter: (r, c, v, i) => this.$dateFormat(v), },

        {
          key: 'operatorName', label: 'label_operate_user', 'width': 130,
          formatter: (r, c, v, i) => this.$formatNameCode(v, r.operatorCode)
        },
        {
          type: 'operate', width: 160, fixed: "right", operate: [
            {
              type: 'more',
              items: [
                { label: 'label_view_detail', click: (row) => this.clickDetail(row) },
                { label: 'label_putaway', auth: "/page/wms/overseas/inbound/putaway", click: (row) => { this.gotoPutaway(row) } },
                // { label: 'label_report_exception', click: (row) => this.reportAnomaly(row), },


              ]
            }
          ]
        }
      ]
    },

    gotoPutaway(row) {
      this.$router.push({ path: '/page/wms/overseas/inbound/putaway', query: { 'inboundOrderCode': row.inboundOrderCode } })
    },
    gotoCheck(row) {
      let query = {}
      if (row) {
        query = { 'inboundOrderCode': row.inboundOrderCode }
      }
      this.$router.push({ path: '/page/wms/overseas/inbound/check', query })
    },

    clickDetail(row) {
      // let title = `${this.$tt('label_acceptance_code')}:${row.code}/${this.$tt('label_inbound_code')}:${row.inboundOrderCode}`
      // this.$refs['detail_overseas_check'].show({ params: { acceptanceId: row.id }, title })

      this.$router.push({ name: '/page/wms/overseas/inbound/check_detail', query: { 'id': row.id, code: row.code, order: row.inboundOrderCode, } })
    },
  }
};

</script>
<style></style>
